package com.gz.springcloud.controller;

import com.gz.springcloud.entity.Member;
import com.gz.springcloud.entity.Result;
import com.gz.springcloud.service.MemberFeignService;
import jdk.nashorn.internal.ir.annotations.Reference;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class MemberConsumerFeignController {

    //装配MemberFeignService
    @Resource
    private  MemberFeignService memberFeignService;

    @GetMapping("/member/consumer/openfeign/get/{id}")
    public Result<Member> getMemberById(@PathVariable("id") Long id) {
        //远程调用接口
        //访问的服务注册用的是@FeignClient(value = "MEMBER-SERVICE-PROVIDER")
        //接口中是@GetMapping("/member/get/{id}")
        //这里是@GetMapping("/member/consumer/openfeign/get/{id}")
        return memberFeignService.getMemberById(id);
    }
}
